package com.kingnare {
    
    import flash.display.Sprite;
    import mx.core.Application;
    import mx.core.IFlexDisplayObject;
    import mx.managers.PopUpManager;
    import view.AlertCanvas;
    
    public class AlertTip{
        
        public static var globalDelay:uint = 1000;
        
        public function AlertTip(){
        }
        /**
         * 提示显示方法
         * message:提示信息
         * delay:可显示的时间
         * modal:背景变灰
         * initValue:初始化数值
         * parent:父级
         */
        public static function show(message:String="", delay:int=-1, modal:Boolean=false, initValue:Object=null, parent:Sprite=null):void{
            if(delay<0) delay = globalDelay;
            if (!parent) parent = Sprite(Application.application);
            var alert:IFlexDisplayObject = PopUpManager.createPopUp(parent, AlertCanvas, modal);
            AlertCanvas(alert).msg = message;
            AlertCanvas(alert).delay = delay;
            AlertCanvas(alert).init = initValue;
            PopUpManager.centerPopUp(alert);
        }
    }
    
}